// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.

import "babel-polyfill";
import Vue from 'vue'
import Vuex from 'vuex'
import store from './store/store'
import App from './App'
import router from './router'
import axios from 'axios'
import 'assets/lib/base64q5h3/jquery.base64.js'
import 'assets/lib/base64q5h3/parseJson.js'
import 'assets/lib/bridge/bridge.js'
import 'assets/lib/md5/md5.js'
import 'assets/lib/weixinshare/weixinshare.js'
import 'assets/css/bootstrap.css'
import 'assets/css/iconfont.css'
import 'assets/css/dropload.css'
import 'assets/css/app.css'
import 'assets/css/gtjn.css'
import 'assets/css/situation.css'
import 'assets/css/stock.css'
import 'assets/css/portfolio.css'
import 'assets/css/game.css'
import 'assets/css/share.game-rules.css'
import 'assets/css/search.main.css'
import 'assets/css/welcome.css'

Vue.prototype.$http = axios
Vue.config.productionTip = false
Vue.use(Vuex)

router.beforeEach((to, from, next) => {

  setTimeout(() => {
    document.body.scrollTop = 0
  }, 0)
  const path1 = from.path.split('/')
  const path2 = to.path.split('/')
  if (path1[1] !== path2[1] && !!from.name) store.dispatch('addHistoryLength') // 判断一级路由是否跳
	next()
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  store,
  router,
  template: '<App/>',
  components: {App},
  data: {
    eventHub: new Vue()
  }
})
